package com.jiaai.web.xiaoke.message;

import com.alibaba.dubbo.config.annotation.Reference;
import com.jiaai.exception.ServerException;
import com.jiaai.push.api.IFeedbackApi;
import com.jiaai.push.model.TFeedbackVO;
import com.jiaai.util.RestResultGenerator;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 佳爱网络科技
 * @since 2018-03-07
 */
@RestController
@RequestMapping("/api/v1/app/tFeedback")
public class AppFeedbackController {
    @Reference
    IFeedbackApi iFeedbackApi;

    /**
     * app接收意见反馈
     * @param tFeedbackVO
     * @return
     * @throws Exception
     */
    @PostMapping("/addMessage")
    public Object addFamily(TFeedbackVO tFeedbackVO) throws ServerException {
        try {
            iFeedbackApi.addMessage(tFeedbackVO);
            return RestResultGenerator.genSuccessResult("添加成功");
        } catch (Exception e) {
            throw new ServerException("添加失败");
        }
    }
}
